package com.example.homework6;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.fragment.app.Fragment;

public class Fragment2 extends Fragment {

    private Button button;
    private Button button2;
    private Button button3;

    public Fragment2(){
        super(R.layout.fragment2);
    }

    public void onViewCreated(View view, Bundle saveInstanceState) {
        super.onViewCreated(view, saveInstanceState);
        button = getView().findViewById(R.id.button);
        button2 = getView().findViewById(R.id.button2);
        button3 = getView().findViewById(R.id.button3);

        button.setOnClickListener(new View.OnClickListener(){
            public void onClick(View v) {
                Intent intent = getActivity().getPackageManager().getLaunchIntentForPackage("tv.danmaku.bili");
                startActivity(intent);
            }
        });

        button2.setOnClickListener(new View.OnClickListener(){
            public void onClick(View v) {
                Intent intent2 = getActivity().getPackageManager().getLaunchIntentForPackage("com.tencent.mm");
                startActivity(intent2);
            }
        });

        button3.setOnClickListener(new View.OnClickListener(){
            public void onClick(View v) {
                Intent intent3 = getActivity().getPackageManager().getLaunchIntentForPackage("com.tencent.qqlive");
                startActivity(intent3);
            }
        });
    }
}